<template>
    <div class="box">
        <h2>
            这是B组件,{{ count.num }}
            <el-button type="primary" size="default" @click="count.num--">
                数字-
            </el-button>
            <el-button type="success" size="default" @click="cart.cartAdd">
                加入购物车 {{ cart.total.totalPrice }}
            </el-button>
            
        </h2>
    </div>
</template>

<script setup>
import {useCount} from '../../store/count.js'
import {useCart} from '../../store/cart.js'
const count = useCount()
const cart = useCart()
</script>

<style scoped>
.box{
    height: 400px;
    width: 40%;
    border: 1px solid #333;
}
</style>